-
Notifications
You must be signed in to change notification settings - Fork 1
feat: gomod private repo support #56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
# What? Migrates the git clone component of the git strategy into a separate API # Why? Experimentation on implementing private repo support for the gomod strategy in #56 revealed we are likely better off separating the git clone behaviour so that it can be shared between multiple strategies.
Co-authored-by: Alec Thomas <aat@block.xyz>
Co-authored-by: Alec Thomas <aat@block.xyz>
e4569a0 to
2a077c9
Compare
alecthomas
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How are we testing this, do we have a way?
| homeDir, err := os.UserHomeDir() | ||
| if err != nil { | ||
| return nil, errors.Wrap(err, "get user home directory") | ||
| } | ||
| mirrorRoot = filepath.Join(homeDir, ".cache", "cachew", "gomod-git-mirrors") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should require a config path so we can put all state into a single directory, like we do with the other git mirrors.
Also remind me again why we can't reuse our existing git mirrors?
| } | ||
|
|
||
| // Create gitclone manager for private repositories | ||
| cloneManager, err := gitclone.NewManager(ctx, gitclone.Config{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should construct the gitclone manager in main and inject it into the gomod strategy. This'll require some refactoring of the factory functions, so I'll do that post merge.
| f, err := w.Create(prefix + "go.mod") | ||
| assert.NoError(t, err) | ||
| if err != nil { | ||
| panic(err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure why this was changed, but the old behaviour was correct - we should never panic in tests.
What?
This PR adds support for private gomod repositories via github. This builds on the existing git caching capabilities within Cachew.
Why?
So that we are able to cache private go modules.
Tests
Unit testing has been added, but manual verification has also been performed...
First create a configuration:
Then test a private repository.